/**
 * Created by hjqi on 2016/2/7.
 */


var bitbucket_oauth = require('./oauth_bitbucket');
var github_oauth = require('./oauth_github');
var OAuthMap = {};

function getOAuth(type){
    if(OAuthMap[type] === undefined){
        var obj = undefined;
        switch (type)
        {
            case 'github':
                obj= new github_oauth();
                break;
            case 'bitbucket':
                obj=new bitbucket_oauth();
                break;
            default:
                ;
        }

        if(obj !== undefined)
            OAuthMap[type] = obj;

        return obj;

    }else
        return OAuthMap[type];
}

exports.getOAuth = getOAuth;